package com.lanswon.qzsmk.controller.inventoryManageController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lanswon.qzsmk.annotation.SystemControllerLog;
import com.lanswon.qzsmk.model.StockSum;
import com.lanswon.qzsmk.service.systemManageService.InventoryManagementService;
import com.lanswon.qzsmk.vo.QueryIncomingAndOutGoing;

import ch.qos.logback.classic.Logger;


@Controller
@RequestMapping(value = "/inventoryQueryOfIncomingAndOutgoing")
public class InventoryQueryOfIncomingAndOutgoingController {
	//queryIncomingAndOutgoing
	
	private final static Logger logger = (Logger) LoggerFactory.getLogger(InventoryQueryOfIncomingAndOutgoingController.class);
	
	@Autowired
	InventoryManagementService ims;
	
	@RequiresPermissions("inventoryQueryOfIncomingAndOutgoing:index")
	@RequestMapping(name = "出入库查询,inventoryQueryOfIncomingAndOutgoing:index",value = "/queryIncomingAndOutgoing", method = RequestMethod.GET)
	public String queryInventory(HttpServletRequest request) {

		return "QueryIncomingAndOutgoing";
	}
	
	@RequiresPermissions("inventoryQueryOfIncomingAndOutgoing:getIncomingAndOutgoingInfo")
	@RequestMapping(name = "库存出库信息查询加载,inventoryQueryOfIncomingAndOutgoing:getIncomingAndOutgoingInfo",value = "/getIncomingAndOutgoingInfo", method = RequestMethod.POST)
	@ResponseBody
	@SystemControllerLog(description = "加载出入库信息")
	public Map<String,Object> getIncomingAndOutgoingInfo(HttpServletRequest request) {
		logger.debug("############getIncomingAndOutgoingInfo start()##########");
		Map<String,Object> resultMap = new HashMap<String,Object>();
		List<QueryIncomingAndOutGoing> stockSumObj = ims.queryIncomingAndOutgoingInfo(request);
		resultMap.put("list", stockSumObj);
		logger.debug("############getIncomingAndOutgoingInfo end()##########");
		return resultMap;
	}
}
